#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
LL n,m,ans,MOD=998244353;

void ex(LL a,LL b){a=a+b;b=a-b;a=a-b;}

void read(LL &x){
	x=0;
	int f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	x*=f;
}

void writ(LL &x){
	LL X=x,NUM=0;
	char ch[25];
	ch[NUM++]=(X%10)+'0';
	X/=10;
	while(X){
		ch[NUM]=(X%10)+'0';
		NUM++;
		X/=10;
	}
	while(NUM)putchar(ch[--NUM]);
}

LL gcd(LL a,LL b){
	if(b>a)ex(a,b);
	if(b==0)return a;
	else return gcd(b,a%b);
}

int main(){
	freopen("hoip.in","r",stdin);
	freopen("hoip.out","w",stdout);
	read(n);read(m);
	//printf("%lld %lld",n,m);
	for(LL i=1;i<=n;i++){
		for(LL j=1;j<=m;j++){
			ans+=gcd(i,j);
			ans%=MOD;
		}
	}
	writ(ans);
	return 0;
}
